#pragma once
#include "MemLink.hpp"
#include "TLV.hpp"

namespace linkfabric {
class LinkFabric {
public:
    LinkFabric(MemLink& mem);
    int openChannel(ChannelPermission perm);
    void freeChannel(int channelId);
    bool send(int channelId, const std::vector<TLV>& tlvs);
    void onReceive(int channelId, std::function<void(const std::vector<TLV>&)> callback);
    void run();

private:
    MemLink& mem_;
};
}